﻿// Logger_Test.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include <iostream>
#include "logger.h"

using namespace std;
using namespace toolkit;

int main()
{
	//日志输出级别
	LogLevel logLevel = (LogLevel)LTrace;
	//设置日志
	//输出到屏幕
	Logger::Instance().add(std::make_shared<ConsoleChannel>("ConsoleChannel", logLevel));
	//输出到文件
	auto fileChannel = std::make_shared<FileChannel>("FileChannel", exeDir() + "log/", logLevel);
	//日志最多保存天数
	fileChannel->setMaxDay(7);
	//日志大小2MB
	fileChannel->setFileMaxSize(2);
	Logger::Instance().add(fileChannel);

	//启动异步日志线程
//	Logger::Instance().setWriter(std::make_shared<AsyncLogWriter>());

	TraceL << "TraceL hello";
	DebugL << "DebugL hello";
	InfoL << "InfoL hello";
	WarnL << "WarnL hello";
	ErrorL << "ErrorL hello";
	ErrorL << 1;

    system("pause");
    return 0;
}
